<template>
  <div>
    <div class="wrapper">
      <p>公司名称：{{ storeData.companyName }}</p>
      <p>公司地址：{{ storeData.companyAddress }}</p>
      <p>公司地址地区：{{ storeData.companyAddressPath }}</p>
      <p>员工人数：{{ storeData.employeeNum }}</p>
      <p>法定经营范围：{{ storeData.scope }}</p>
      <image @click="preview()" w-full h-400rpx mode="aspectFit" :src="storeData.licencePhoto"></image>
    </div>
  </div>
</template>

<script setup lang="ts">
import { getLicensePhoto } from "@/api/shops";
import { onLoad, onShow } from "@dcloudio/uni-app";

const routerVal = ref<any>({})
const storeData = ref<any>({})

onLoad((options: any) => {
  routerVal.value = options
})

function preview() {
  uni.previewImage({
    current: 0,
    urls: [storeData.value.licencePhoto],
    longPressActions: {
      itemList: ["保存图片"],
      success: function (data) { },
      fail: function (err) { },
    },
  });
}

async function init() {
  const res = await getLicensePhoto(routerVal.value.id)
  if (res.data.success) {
    storeData.value = res.data.result;
  }
}

onShow(() => {
  init()
})
</script>

<style scoped lang="scss">
.wrapper {
  padding: 32rpx;

  >p {
    margin: 20rpx 0;
  }
}
</style>
